package classwork.demo1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class JdbcDemo5 {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");

        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/db2", "root", "root");
        Statement statement = connection.createStatement();
        ResultSet resultSet = statement.executeQuery("Select * from stu where id='2'");

        while (resultSet.next()){
            System.out.println(resultSet.getString("name")+"\t"+resultSet.getString("password"));
        }

    }
}
